import BTDecorator from "../../Base/BTDecorator";
import BTNode from "../../Base/BTNode";
import { NodeStatues } from "../../Enum";


export default class DecoratorInverter extends BTDecorator {

    onUpdate(): NodeStatues {
        const res = this.children[0].run();
        return this.decorate(res);
    }

    public decorate(statues: NodeStatues): NodeStatues {
        switch (statues) {
            case NodeStatues.Success:
                return NodeStatues.Failed;
            case NodeStatues.Failed:
                return NodeStatues.Success;
            default:
                return statues;
        }
        return
    }
}